package org.lg.studyspringboot20.dto;

import java.io.IOException;
import java.util.Properties;

/**
 * 主要用于存放各种提示信息
 * @author:LG
 * @date:Created at 2019/03/09
 */
//一个消息类 有两种成员变量一种是小写的可以改变的变量（读取properties文件），第二种是大小的不能改变的变量（提供给DTO）
public class Messages {
    private static String getStudentSuccess= "";
    private static String getStudentFail= "";
    private static String addStudentSuccess= "";
    private static String addStudentFail= "";
    private static String deleteStudentSuccess= "";
    private static String deleteStudentFail= "";
    private static String updateStudentSuccess= "";
    private static String updateStudentFail= "";




   static{
       Properties prop = new Properties();// 空的配置类
       try {
           prop.load(Messages.class.getResourceAsStream("/messages.properties"));// Object.class找到jvm运行的class文件所在的目录，
       } catch (IOException e) {
           e.printStackTrace();
       }
       // getResourceAsStream 以流的形式将文件读到内存，不写/ 根路径表示当前class所在的文件夹下面找文件 写
       // 根路径就是当前项目下面找文件 bin
       getStudentSuccess = prop.get("getStudentSuccess").toString();
       getStudentFail = prop.get("getStudentFail").toString();
       addStudentSuccess = prop.get("addStudentSuccess").toString();
       addStudentFail = prop.get("addStudentFail").toString();

       deleteStudentSuccess = prop.get("deleteStudentSuccess").toString();
       deleteStudentFail = prop.get("deleteStudentFail").toString();
       updateStudentSuccess = prop.get("updateStudentSuccess").toString();
       updateStudentFail = prop.get("updateStudentFail").toString();



   }
    /*学生模块操作信息*/
    public final static String GETSTUDENTSUCCESS= getStudentSuccess;
    public final static String GETSTUDENTFAIL= getStudentFail;
    public final static String ADDSTIUDENTSUCCESS= addStudentSuccess;
    public final static String ADDSTIUDENTFAIL= addStudentFail;

    public final static String DELETESTUDENTSUCCESS= deleteStudentSuccess;
    public final static String DELETESTUDENTFAIL= deleteStudentFail;
    public final static String UPDATESTIUDENTSUCCESS= updateStudentSuccess;
    public final static String UPDATESTIUDENTFAIL= updateStudentFail;


    public static void main(String[] args) {
        System.out.println(Messages.GETSTUDENTFAIL);
    }
}
